#!/home/joshua/.guix-profile/bin/guile \
-e main -s
!#

;; This is a simple pre-fix calculator.  Things it can calculate
;; + 3 4
;; + 3 - 5 3

;; use these modules to help my process the command line arguments.
(use-modules (ice-9 getopt-long))

;; this will take a list and calculate the whole thing.
(define (calc list)
  (let ([first-arg]))
  )

(define (main args)
  ;;the option specification tells getopt-long how
  ;; to parse the command line
  (let* ((option-spec '((version (single-char #\v) (value #f))
                        (help    (single-char #\h) (value #f))
                        (calc    (single-char #\c) (value #t)
                                 ;; (required #t)
                                 )))
         ;; tell getopt-long to parse the command line and put the
         ;; data in options
         (options (getopt-long args option-spec))
         ;; was  --help or -h used?
         (help-wanted (option-ref options 'help #f))
         (version-wanted (option-ref options 'version #f))
         ;; was -c or --calc used?  If there was no value given,
         ;; then return #f
         (calc-wanted (option-ref options '() #f)))
    (if (or version-wanted help-wanted)
        (cond
         (help-wanted
          (display "calc [options]\n")
          (display "-v  --version  Display version\n")
          (display "-h, --help     Display this help info\n"))
         (version-wanted
          (display "calc version 0.1\n")))
        (display calc-wanted))))
